#include<stdio.h>

int main(void)
{
	int start,stop,d,n,sum;
	
	scanf("%d%d%d",&start,&stop,&d);
	n=(stop-start+d)/d;
	sum=(start+stop)*n/2;
	printf("%d",sum);
	return 0;
}
